package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.ListUserDao;

import util.DbUtil;
import vo.ListUser;

public class ChaXunServlet extends HttpServlet {
	
	DbUtil dbUtil=new DbUtil();
	ListUserDao listuserdao=new ListUserDao();
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String id=String.valueOf(request.getParameter("textfield2"));
		
		try{
			Connection con=null;
			con=dbUtil.getCon();
			ListUser listuser=listuserdao.chaXun(con, id);
			List<ListUser> list=new ArrayList<ListUser>();
			list.add(listuser);
			request.setAttribute("list", list);
			
		}catch(Exception e){
			e.printStackTrace();
		}
		request.getRequestDispatcher("listUser2.jsp").forward(request,response);
		
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doGet(request,response);
	}

}
